#ifndef	__APP_KEY_H
#define	__APP_KEY_H

#include "stm32g0xx_hal.h"


#define	KEY_TACT_LIMIT_PORT_CLK		__HAL_RCC_GPIOC_CLK_ENABLE
#define	KEY_PUSH_KEY4_PORT_CLK		__HAL_RCC_GPIOA_CLK_ENABLE


#define	KEY_TACT_PORT		GPIOC
#define	KEY_LIMIT_PORT		GPIOC
#define	KEY_PUSH_PORT		GPIOA
#define	KEY4_PORT			GPIOA


#define	KEY_TACT_PIN		GPIO_PIN_14
#define	KEY_LIMIT_PIN		GPIO_PIN_15
#define	KEY_PUSH_PIN		GPIO_PIN_5
#define	KEY4_PIN			GPIO_PIN_12


#define	KEY_TACT_READ()		HAL_GPIO_ReadPin(KEY_TACT_PORT, KEY_TACT_PIN)
#define	KEY_LIMIT_READ()	HAL_GPIO_ReadPin(KEY_LIMIT_PORT, KEY_LIMIT_PIN)
#define	KEY_PUSH_READ()		HAL_GPIO_ReadPin(KEY_PUSH_PORT, KEY_PUSH_PIN)
#define	KEY4_READ()			HAL_GPIO_ReadPin(KEY4_PORT, KEY4_PIN)



#define	KEY_PRESSED			GPIO_PIN_RESET
#define	KEY_NOT_PRESSED		GPIO_PIN_SET

#define	KEY_TACT			(0x01)
#define	KEY_LIMIT			(0x02)
#define	KEY_PUSH			(0x04)
#define	KEY4				(0x08)


void APP_KEY_Init(void);
void APP_KEY_Scan(uint8_t *KEY_Scan);


#endif

